package com.yao.koin.repository

import com.yao.koin.api.BaseRepository
import com.yao.koin.api.GanRetrofitClient
import com.yao.koin.bean.BannerChild
import com.yao.koin.bean.DataX
import com.yao.koin.util.Result

class HomeRepository : BaseRepository() {




    suspend fun getBanner(): Result<List<BannerChild>> {
        return safeApiCall(call = { requestBannerList() }, errorMessage = "")
    }
    private suspend fun requestBannerList(): Result<List<BannerChild>> =
        executeResponseBanner(GanRetrofitClient.service.getBanners())


    suspend fun getGridList(page: Int): Result<List<DataX>> {
        return safeApiCall(call = { requestGridList(page) }, errorMessage = "")
    }

    private suspend fun requestGridList(page: Int): Result<List<DataX>> =
       executeResponse(GanRetrofitClient.service.getGrid02List(page))

}


